package com.easyCms.base.service;

import com.easyCms.base.common.CodeConst;
import com.easyCms.base.dao.CrmUserDAO;
import com.easyCms.base.entity.CrmUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CrmUserSV {
    @Autowired
    private CrmUserDAO crmUserDAO;

    public CrmUser save(CrmUser crmUser) {
        return crmUserDAO.save(crmUser);
    }

    public CrmUser findByHamiCode(String identityCode) {
        return crmUserDAO.findByHamiCodeAndState(identityCode, CodeConst.State.STATE_VALID);
    }

    public CrmUser findValidByUserName(String userName) {
        return crmUserDAO.findByUserNameAndState(userName, CodeConst.State.STATE_VALID);
    }
}
